<template>
	<!-- transferrecord优惠买单 -->
	<view class="t_wp">
		<!-- <view class="t_tab">
			<view class="t_tab_item" :class="{active:active==1}" @click="navtap(1)">收款记录</view>
			<view class="t_tab_item" :class="{active:active==2}" @click="navtap(2)">付款记录</view>
		</view> -->
		<view class="total">
			<view class="top">
				<view class="one">
					<view class="number">
						<view>昨日</view>
						<view class="num">{{info.yesdaymoney}}</view>
					</view>
					<view class="number">
						<view>今日</view>
						<view class="num">{{info.todaymoney}}</view>
					</view>
				</view>
				<view class="two">
					<view class="number">
						<view>上月</view>
						<view class="num">{{info.pdaymoney}}</view>
					</view>
					<view class="number">
						<view>本月</view>
						<view class="num">{{info.tmonthmoney}}</view>
					</view>
				</view>
			</view>
			<view class="bottom">优惠买单营业额统计</view>
		</view>
		<view class="head">
			<view class="tit">多米街用户消费明细</view>
			<view>扫码转账</view>
		</view>
		<view class="list">
			<view class="item" v-for="(item,i) in list" :key="i">
				<view class="top">
					<view class="left">
						<view class="tit">{{item.remark}}</view>
						<view class="time">支付时间：{{item.createtime}}</view>
					</view>
					<view class="right">卡内余额：<text class="purple">{{item.usemoney}}</text></view>
				</view>
				<view class="bottom">
					<view class="flex">
						<view>顾客原价消费</view>
						<text class="purple">-{{item.price}}</text>
					</view>
					<view class="flex">
						<view>支付现金</view>
						<text class="red">{{item.money}}</text>
					</view>
					<view class="flex">
						<view class="green">核销人</view>
						<text class="green">{{item.checkname}}</text>
					</view>
					<view class="flex">
						<view class="time">核销时间</view>
						<text class="time">{{item.checktime}}</text>
					</view>
				</view>
			</view>
		</view>
		<view class="empty_loading">
			<image v-if="isloading" src="/static/business/loading.gif"></image>
			<view v-if="isempty">到底了~</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				uid:'',
				active: 1,
				content:{credit1:0,money:0},
				info:[],
				page: 0,
				list: [],
				isempty: false,
				isloading: false,
				stopload: false,
			}
		},
		onReachBottom() {
			if (this.active == 1) this.getilist();
			if (this.active == 2) this.gettlist();
		},
		onLoad(option) {
			this.uid=option.uid;
			this.getilist();
			this.getInfo();
		},
		methods: {
			navtap(v) {
				if (this.active == v) return;
				this.content={credit1:0,money:0};
				this.active = v;
				this.stopload = false;
				this.page = 0;
				this.isempty = false;
				this.list = [];
				if (v == 1) this.getilist();
				if (v == 2) this.gettlist();
			},
			assignment(data){
				this.content=data.content;
				let length = data.log.length;
				this.list = this.list.concat(data.log);
				this.isempty = length <= 0 ? true : false;
				this.stopload = length <= 0 ? true : false;
			},
			getInfo(){
				this.$axios('groupManager/incomehead', 'POST', 'supplier', {
					uid:this.uid,
				}).then(res => {
					if (res.data.code == 200) {
						this.info = res.data.data.head;
					}
				})
			},
			gettlist() {
				if (this.stopload) return;
				this.stopload = true;
				this.page += 1;
				this.isloading = true;
				this.$axios('groupManager/trans', 'POST', 'supplier', {
					page: this.page,
					uid:this.uid,
				}).then(res => {
					this.isloading = false;
					if (res.data.code == 200) {
						this.assignment(res.data.data);
					}
				})
			},
			getilist() {
				if (this.stopload) return;
				this.stopload = true;
				this.page += 1;
				this.isloading = true;
				this.$axios('groupManager/income', 'POST', 'supplier', {
					page: this.page,
					uid:this.uid,
				}).then(res => {
					this.isloading = false;
					if (res.data.code == 200) {
						this.assignment(res.data.data);
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #FBF8FE;
		padding-bottom: 60rpx;
		color: #333333;
	}
	.t_wp{
		padding: 20rpx;
	}
	.total{
		border: 2rpx solid #8615E1;
		border-radius: 24rpx;
		overflow: hidden;
		.top{
			height: 332rpx;
			background: linear-gradient( 135deg, #B92DF1 0%, #8A17E2 100%);
			border-radius: 24rpx;
			padding: 40rpx;
			color: #ffffffbf;
			position: relative;
			.one{
				border-bottom: 1rpx solid rgba(#fff,.22);
				font-size: 24rpx;
				display: flex;
				justify-content: space-between;
				padding-bottom: 26rpx;
				.number{
					width: 50%;
				}
				.num{
					font-weight: 600;
					font-size: 72rpx;
					color: #FFFFFF;
				}
			}
			.two{
				font-size: 20rpx;
				display: flex;
				justify-content: space-between;
				padding: 26rpx 0 0;
				.number{
					width: 50%;
				}
				.num{
					font-weight: 600;
					font-size: 36rpx;
					color: #FFFFFF;
				}
			}
		}
		.bottom{
			background: #F1DDF8;
			font-size: 24rpx;
			color: #8615E1;
			font-weight: 600;
			line-height: 80rpx;
			text-align: center;
			margin-top: -30rpx;
			height: 106rpx;
			line-height: 53px;
			padding-top: 16rpx;
		}
	}
	.head{
		display: flex;
		justify-content: space-between;
		line-height: 3;
		align-items: center;
		.tit{
			font-weight: 600;
			font-size: 32rpx;
			color: #333333;
		}
	}
	.flex{
		display: flex;
		justify-content: space-between;
		align-items: center;
	}
	.list{
		.item{
			padding: 20rpx 34rpx;
			font-size: 24rpx;
			color: #333333;
			background: #FFFFFF;
			border-radius: 12rpx;
			margin-bottom: 20rpx;
			.purple{
				color: #8615E1;
				font-weight: 600;
			}
			.red{
				font-weight: 600;
				color: #AF141D;
			}
			.green{
				color: #333300;
			}
			.time{
				color: #999999;
			}
			.top{
				border-bottom: 1rpx solid #DEDEDE;
				padding-bottom: 22rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				.tit{
					font-size: 28rpx;
					font-weight: 600;
					color: #333333;
				}
			}
			.bottom{
				padding: 20rpx 0 0;
				line-height: 2;
			}
		}
	}
</style>
